﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SwParaPlatform2.dlgUIConfig
{
    // 定义通用的事件参数类
    public class GenericEventArgs<T> : EventArgs
    {
        public T Data { get; }

        public GenericEventArgs(T data)
        {
            Data = data;
        }
    }

    // 定义事件和委托
    public delegate void EventHandler();

    public interface IDelegate
    {
        void InitializeInputTypeList();
    }

    public interface IModel
    {
        List<string> GetInputTypeList();
        Dictionary<string, Dictionary<string, object>> GetGridDataDict();
        string GetSelectPara();

        event EventHandler GridDataChanged;
        event EventHandler SelectParaChanged;
        event EventHandler SelectViewFilePathChanged;
        event EventHandler<int> DoSelectIndex;
        List<string> GetOrder();
        void SaveOrder(List<string> lOrder);
        void DelEditRow();
        void SaveData();
        void LoadData();
        void LoadAllData();
        void UpBtn_Click();
        void DownBtn_Click();
        void ClearData(bool bClearAllData);
        void AddEditRow(Dictionary<string, object> data);
        void OnSelectRow(string sSelectPara);
        void OnSelectMainViewPic(string viewFilePath);
        string GetViewFilePath();
    }

    public interface IView
    {
        event System.EventHandler NextClicked;
        event System.EventHandler LoadDataBtnClicked;
        event System.EventHandler SaveBtnClicked;
        event System.EventHandler UpBtnClicked;
        event System.EventHandler DownBtnClicked;
        event EventHandler<int> DelEditRow;
        event EventHandler<string> SelectRow;
        event EventHandler<string> OnCheckedChanged;
        event EventHandler<GenericEventArgs<(int, Dictionary<string, object>)>> ChangeEditRow;
        event EventHandler<GenericEventArgs<Dictionary<string, object>>> AddEditRow;
        event EventHandler<GenericEventArgs<List<string>>> SaveOrder;

        event Action<string> InputTypeChanged;

        void ShowError(string message);
        void RefreshDataGrid(List<KeyValuePair<string, Dictionary<string, object>>> lSortDataList);
        void SetInputTypeList(List<string> inputTypeList);
        void OnSelectEditType(string sSelectType);
        void RefreshSelectPic(string sSelectViewFilePath);
        void OnSelectIndex(int iIndex);
        void OnSelectPara(Dictionary<string, object> dSelectData);
    }

}
